home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / src / dd / typecheck.txt < prev    next >
Text File  |  1992-12-01  |  3KB  |  93 lines

  1. Well, for anything that is MEMORY (not hardware) you can do TypeOfMem()...
  2.  
  3. For things that are hardware, checking the board list would give you that.
  4.  
  5. Here is an example code section to mapping memory addresses.  You can
  6. use it to build your own map...
  7.  
  8. The only trick is that low memory (location 0 to 1024 or 4096 depending
  9. on the CPU) is protected too...  This is what the new WACK uses...
  10.  
  11.                         -- Mike
  12.  
  13.  
  14.         /*
  15.          * Now for the control areas...
  16.          */
  17.         mmu=Mark_Address(mmu,0x00BC0000,0x00040000,NONCACHEABLE);
  18.         mmu=Mark_Address(mmu,0x00D80000,0x00080000,NONCACHEABLE);
  19.  
  20.         /*
  21.          * Now for F-Space...
  22.          */
  23.         mmu=Mark_Address(mmu,0x00F00000,0x00080000,CACHEABLE);
  24.  
  25.         /*
  26.          * Now for the ROM...
  27.          */
  28.         mmu=Map_ROM(mmu,ROM_Addr);      /* Usually just F80000 for 512K */
  29.  
  30.         /*
  31.          * If the credit card resource, make the addresses valid...
  32.          */
  33.         if (OpenResource("card.resource"))
  34.         {
  35.                 mmu=Mark_Address(mmu,0x00600000,0x00440002,NONCACHEABLE);
  36.         }
  37.  
  38.         /*
  39.          * If CDTV, make CDTV hardware valid...
  40.          */
  41.         if (FindResident("cdstrap"))
  42.         {
  43.                 mmu=Mark_Address(mmu,0x00E00000,0x00080000,NONCACHEABLE);
  44.         }
  45.  
  46.         /*
  47.          * Check for ReKick/ZKick/KickIt
  48.          */
  49.         if ((((ULONG)(SysBase->LibNode.lib_Node.ln_Name)) >> 16) == 0x20)
  50.         {
  51.                 mmu=Mark_Address(mmu,0x00200000,0x00080000,CACHEABLE);
  52.         }
  53.  
  54.         /*
  55.          * Special case the first page of CHIP RAM
  56.          */
  57.         mmu=Mark_Address(mmu,0,0x1000,NONCACHEABLE);
  58.  
  59.         /*
  60.          * Now, put in the free memory
  61.          */
  62.         Forbid();
  63.         mem=(struct MemHeader *)SysBase->MemList.lh_Head;
  64.         while (mem->mh_Node.ln_Succ)
  65.         {
  66.                 mmu=Mark_Address(mmu,(ULONG)(mem->mh_Lower),(ULONG)(mem->mh_Uppe
  67. r)-(ULONG)(mem->mh_Lower),((MEMF_CHIP & TypeOfMem(mem->mh_Lower)) ? NONCACHEABLE
  68.  : CACHEABLE));
  69.                 mem=(struct MemHeader *)(mem->mh_Node.ln_Succ);
  70.         }
  71.         Permit();
  72.  
  73.         /*
  74.          * Map in the autoconfig boards
  75.          */
  76.         if (ExpansionBase=OpenLibrary("expansion.library",0))
  77.         {
  78.         struct  ConfigDev       *cd=NULL;
  79.  
  80.                 while (cd=FindConfigDev(cd,-1L,-1L))
  81.                 {
  82.                         /* Skip memory boards... */
  83.                         if (!(cd->cd_Rom.er_Type & ERTF_MEMLIST))
  84.                         {
  85.                                 mmu=Mark_Address(mmu,(ULONG)(cd->cd_BoardAddr),c
  86. d->cd_BoardSize,NONCACHEABLE);
  87.                         }
  88.                 }
  89.                 CloseLibrary(ExpansionBase);
  90.         }
  91.  
  92. & re
  93.